/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */

import React, {Component} from 'react';
import {
    createAppContainer,
    createBottomTabNavigator,
    createSwitchNavigator
} from "react-navigation";
import HomeScreen from './mondule/home/HomeScreen';
import MineScreen from './mondule/mine/MineScreen';
import LoginScreen from './mondule/login/LoginScreen';
import Ionicons from 'react-native-vector-icons/Ionicons';

// createBottomTabNavigator(RouteConfigs, BottomTabNavigatorConfig);
const routeConfigs = {
    HomeScreen: {
        screen: HomeScreen,
        navigationOptions:{
            tabBarIcon: ({tintColor, focused}) => (
                <Ionicons
                    name={'ios-home'}
                    size={26}
                    style={{color: tintColor}}
                />
            ),
        }
    },
    MineScreen: {
        screen: MineScreen,
        navigationOptions:{
            tabBarIcon: ({tintColor, focused}) => (
                <Ionicons
                    name={'ios-chatboxes'}
                    size={26}
                    style={{color: tintColor}}
                />
            ),
        }
    },
};

const bottomTabNavigatorConfig = {
    initialRouteName: "HomeScreen",
    tabBarOptions: {
        activeTintColor: '#e91e63',
        labelStyle: {
            fontSize: 12,
        },
        style: {
            backgroundColor: 'white',
        },
    }
};

const BottomTabNavigator = createBottomTabNavigator(routeConfigs, bottomTabNavigatorConfig);

const SwitchNavigator = createSwitchNavigator({
    Login: LoginScreen,
    BottomTabScreen: BottomTabNavigator
},{
    initialRouteName: 'Login',
});

const AppContainer = createAppContainer(SwitchNavigator);

export default class Navigator extends Component {
    render() {
        return <AppContainer/>
    }
}
